package com.hj.authority.dao;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;

import com.hj.authority.domain.entity.SysUser;
import com.hj.mybatis.dao.BaseDao;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * @author hj
 * @Date 2023/4/27
 * @Description: SysUserDao
 */
@Mapper
public interface SysUserDao extends BaseDao<SysUser> {

    List<SysUser> getList(Map<String, Object> params);

    SysUser getById(@Param("id") Long id);

    List<SysUser> getRoleUserList(Map<String, Object> params);

    /**
     * 根据账号查找用户
     *
     * @param username username
     * @return SysUser
     */
    default SysUser getByUsername(String username) {
        return this.selectOne(new QueryWrapper<SysUser>().eq("username", username));
    }

}